//
//  IvanTEST.m
//  YuchBox
//
//  Created by Ivan on 11-10-11.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "IvanTEST.h"
#import "UnitTEST.h"
#import "Utility.h"

@implementation IvanTEST

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }
    
    return self;
}
+ (void)dumpdata:(UInt8 *)data len:(NSInteger)len
{
    printf("\n--------------------------------------------------");
    printf("\nBUFF LEN = %d\n", len);
    for (int i = 0; i < len ; i++) {
        if ((i%16)==0 && i != 0) {
            printf("\n");
        }
        printf("%x ", data[i]);
    }
    
}

+ (void)TEST_BEGIN_Enable:(Boolean)enable
{
    if (!enable) return;
    [IvanTEST TEST_NSbundleEnable:YES];
}

+ (void)tmp
{
    //NSDate *date = [NSDate dateWithTimeIntervalSinceNow:0];
    
    //    
    //    NSDateFormatter *dateformat = [[NSDateFormatter alloc] init];
    //    [dateformat setTimeStyle:NSDateFormatterMediumStyle];
    //    [dateformat setDateStyle:NSDateFormatterMediumStyle];
    //    
    //    
    //    NSLog(@"%@", [dateformat stringFromDate:email.sendDate]);
    //    
    //    return;
    
    
    
    //_connectAnimationTimer 
    //    _connectAnimationTimer = [NSTimer scheduledTimerWithTimeInterval:0.9f target:self selector:@selector(connectAnimation:) userInfo:nil repeats:YES];
    //    [_connectAnimationTimer invalidate];
    //    [_connectAnimationTimer isValid
    //    //[connectViewButton setAlpha:0.1f];
    //    [_connectView addSubview:connectViewButton];
    //    [connectViewButton release];
}

+ (void)TEST_NSbundleEnable:(Boolean)enable
{
    if (!enable) return;

    NSBundle *bundle = [NSBundle mainBundle];

    TTLOG_INFO(NSHomeDirectory());
    // /Users/Ivan/Library/Application Support/iPhone Simulator/5.0/Applications/D02FF4D8-6112-4DBF-8C86-D3ADDF3AD439
    
    TTLOG_INFO([bundle builtInPlugInsPath]);
    // /Users/Ivan/Library/Application Support/iPhone Simulator/5.0/Applications/D02FF4D8-6112-4DBF-8C86-D3ADDF3AD439/YuchBox.app/PlugIns
    
    TTLOG_INFO([bundle bundlePath]);
    // /Users/Ivan/Library/Application Support/iPhone Simulator/5.0/Applications/D02FF4D8-6112-4DBF-8C86-D3ADDF3AD439/YuchBox.app
    
    TTLOG_INFO([bundle executablePath]);
    // /Users/Ivan/Library/Application Support/iPhone Simulator/5.0/Applications/D02FF4D8-6112-4DBF-8C86-D3ADDF3AD439/YuchBox.app/YuchBox

    TTLOG_INFO([bundle sharedSupportPath]);
    // /Users/Ivan/Library/Application Support/iPhone Simulator/5.0/Applications/D02FF4D8-6112-4DBF-8C86-D3ADDF3AD439/YuchBox.app/SharedSupport
    
    TTLOG_INFO([bundle sharedFrameworksPath]);
    // /Users/Ivan/Library/Application Support/iPhone Simulator/5.0/Applications/D02FF4D8-6112-4DBF-8C86-D3ADDF3AD439/YuchBox.app/SharedFrameworks
    
    TTLOG_INFO([bundle resourcePath]);
    
    NSString *filePath = [NSString stringWithFormat:@"/Users/Ivan/Library/Application Support/iPhone Simulator/5.0/Applications/D02FF4D8-6112-4DBF-8C86-D3ADDF3AD439/Documents/AttachmentTemp/D066100C"];
    NSError *error;
    NSDictionary *fileAttr = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&error];
    
    NSNumber *fileSize = [fileAttr objectForKey:NSFileSize];

    TTLOG_INFO([fileSize stringValue]);
}
@end
